import request from '@/utils/request'

function url(u) {
  const prefix = '/notice'
  return `${prefix}${u || ''}`
}

export function publishNotice(meetingId, title, content) {
  const data = {
    meetingId,
    title,
    content
  }
  return request({
    url: url(),
    method: 'post',
    data: data
  })
}

export function deleteNotice(id) {
  return request({
    url: url(`/${id}`),
    method: 'delete'
  })
}

export function findNoticeByMeeting(id) {
  return request({
    url: url(`/m/${id}`),
    method: 'get'
  })
}
